<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="http://g.tbcdn.cn/mtb/lib-flexible/0.3.4/??flexible_css.js,flexible.js"></script>
		<script src="js/mock.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/database.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="css/active.css" />
	</head>
	<body>
		<header>
			<img src="img/back.svg" class="back" id="back">
			<h1 class="mui-title">文体活动</h1>
			<img src="img/top-chose.png" class="header-right">
		</header>
		<div id="banner" class="banner">
			<div class="idot space-between" id="idot"></div>
			<ul class="banner-box flex" id="banner-box">
				<li></li>
				<li></li>
				<li></li>
			</ul>
		</div>
		<div id="menu">
			<ul id="menu-ul" class="space-around">
				
			</ul>
		</div>
		<div id="main">
			<h2>征徒体育·最新活动推荐</h2>
			<ul id="main-ul">
				
			</ul>
		</div>
	</body>
	<script src="js/resultbank.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		function banner(){
			app.mockhot('/active-banner', function(res) {
				var responseText = JSON.parse(res);
				var box = document.getElementById('banner-box');
				var li = box.getElementsByTagName('li');
				for (var i = 0; i < responseText.src.length; i++) {
					li[i].style.background = 'url(' + responseText.src[i] + ') no-repeat center center';
				}
			})
			app.banner('banner', 3000);
		}
		banner()
		
		function menu(){
			app.mockhot('/active-menu', function(res) {
				var responseText = JSON.parse(res);
				var oul = document.getElementById('menu-ul');
				for (var i = 0; i < responseText.src.length; i++) {
					var li = document.createElement('li');
					var img = document.createElement('img');
					var p =document.createElement('p');
					img.src=responseText.src[i]
					p.textContent=responseText.title[i]
					oul.appendChild(li);
					li.appendChild(img);
					li.appendChild(p)
				}
			})
		}
		menu()
		
		function main(){
			app.mockhot('/active-main', function(res) {
				var responseText = JSON.parse(res);
				var oul = document.getElementById('main-ul');
				for (var i = 0; i < responseText.src.length; i++) {
					var li = document.createElement('li');
					var img = document.createElement('img');
					var _div = document.createElement('div');
					var _h5=document.createElement('h5');
					var p =document.createElement('p');
					var _span = document.createElement('span');
					var _btn = document.createElement('button');
					_div.classList.add('text');
					img.src=responseText.src[i]
					_h5.textContent=responseText.title
					p.textContent=responseText.label
					_span.textContent="￥"+responseText.value[i]
					_btn.textContent=responseText.btn
					oul.appendChild(li);
					li.appendChild(img);
					li.appendChild(_div)
					_div.appendChild(_h5)
					_div.appendChild(p)
					_div.appendChild(_span)
					_div.appendChild(_btn)
				}
			})
		}
		main()
	</script>
</html>
